#!/bin/bash

# 设置变量
SMTP_SERVER="smtp.163.com"
SMTP_PORT="465"
SMTP_USER="xavier_aurora@163.com"
SMTP_PASS="UUWRASFFOHMLRZTM"
FROM="xavier_aurora@163.com"
TO="2450149591@qq.com"
SUBJECT="Alert!"
BODY="Notice! There are some people drowning in the river! Please help them!"

# 创建邮件内容
echo "From: $FROM" > mail.txt
echo "To: $TO" >> mail.txt
echo "Subject: $SUBJECT" >> mail.txt
echo "" >> mail.txt
echo "$BODY" >> mail.txt

# 使用curl发送邮件
curl --verbose -s --url "smtps://$SMTP_SERVER:$SMTP_PORT" \
--mail-from "$FROM" \
--mail-rcpt "$TO" \
--upload-file mail.txt \
--user "$SMTP_USER:$SMTP_PASS"

# 删除临时文件
rm mail.txt
